home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2004 August / The Sunday Times - The Month 2004-08.iso / pc / engine / modules / pa_search.swf / scripts / DefineSprite_60 / frame_1 / DoAction.as
Encoding:
Text File  |  2004-07-07  |  1.9 KB  |  81 lines

  1. ITEMHEIGHT = 19;
  2. init = function()
  3. {
  4.    var _loc3_ = this;
  5.    if(options.length >= 8)
  6.    {
  7.       var optionsToShow = 8;
  8.    }
  9.    else
  10.    {
  11.       var optionsToShow = options.length;
  12.    }
  13.    var currY = (- ITEMHEIGHT) * optionsToShow;
  14.    mc_mask._y = currY - 1;
  15.    mc_mask._height = ITEMHEIGHT * optionsToShow + 1;
  16.    var _loc1_ = 0;
  17.    while(_loc1_ < options.length)
  18.    {
  19.       var _loc2_ = {};
  20.       _loc2_.title = options[_loc1_];
  21.       _loc2_.optionValue = values[_loc1_];
  22.       _loc2_._y = currY;
  23.       _loc2_._visible = 0;
  24.       mc_options.attachMovie("clp_option","option_" + _loc1_,_loc1_,_loc2_);
  25.       currY += ITEMHEIGHT;
  26.       mc_options["option_" + _loc1_].onRelease = function()
  27.       {
  28.          var _loc1_ = this;
  29.          _loc1_._parent._parent.optionValue = _loc1_.optionValue;
  30.          _loc1_._parent._parent.title = _loc1_.title;
  31.          _loc1_._parent._parent.contract();
  32.       };
  33.       _loc1_ = _loc1_ + 1;
  34.    }
  35.    contract();
  36. };
  37. expand = function()
  38. {
  39.    var _loc1_ = 0;
  40.    while(_loc1_ < options.length)
  41.    {
  42.       mc_options["option_" + _loc1_]._visible = 1;
  43.       _loc1_ = _loc1_ + 1;
  44.    }
  45.    mc_default.gotoAndStop("open");
  46.    if(options.length > 4)
  47.    {
  48.       mc_options._y = 0;
  49.       mc_scrollbar._visible = 1;
  50.       mc_scrollbar.refresh();
  51.       mc_shadows.gotoAndStop("rows_8");
  52.    }
  53.    else
  54.    {
  55.       mc_mask._width = 53;
  56.       mc_shadows.gotoAndStop("rows_3");
  57.    }
  58.    mc_default.onRelease = function()
  59.    {
  60.       this._parent.contract();
  61.    };
  62. };
  63. contract = function()
  64. {
  65.    var _loc1_ = 0;
  66.    while(_loc1_ < options.length)
  67.    {
  68.       mc_options["option_" + _loc1_]._visible = 0;
  69.       _loc1_ = _loc1_ + 1;
  70.    }
  71.    mc_default.gotoAndStop("closed");
  72.    mc_scrollbar._visible = 0;
  73.    mc_shadows.gotoAndStop("small");
  74.    mc_options._y = 0;
  75.    mc_default.onRelease = function()
  76.    {
  77.       this._parent.expand();
  78.    };
  79. };
  80. init();
  81.